#include<stdio.h>
#include<stdlib.h>
#include<stdbool.h>
#include<assert.h>
#include <time.h>

#include "case.h"


void setOuvrirFermerCase ( caseMat *Case,int direct, bool ouv)
{

switch (direct)
{
  case 1:
    if (ouv==true)
    {Case->H =true;

    }
    else
    {Case->H =false;
    }
    break;
  case 2:
    if (ouv==true)
    {Case->D =true;

    }
    else
    {Case->D=false;
    }
    break;
  case 3:
    if (ouv==true)
    {Case->B =true;}
    else
    {Case->B =false;}
    break;
  case 4:
    if (ouv==true)
    {Case->G =true;}
    else
    {Case->G =false;}
  break;
}
}

void setChangeIdent (caseMat *Case, const int *ident)
{
   Case->identCase=*ident;
}

int GetIdentCase(caseMat *Case)
{
    return Case->identCase;
}

void InitCase (caseMat *Case, const int * ident, const int *dimx, const int * dimy)
{
setChangeIdent (Case,ident);
Case->G =false;
Case->D =false;
Case->H =false;
Case->B =false;
}


bool GetH_B_G_D (const caseMat *Case,const int *direct)
{
   //assert (*direct<=5 && *direct>=0);
 bool result;
    switch (*direct)
    {
        case 1:
         result=(Case->H);
         break;
        case 2:
         result=(Case->B);
         break;
        case 3:
         result=(Case->G);
         break;
        case 4:
         result=(Case->D);
         break;
    }
return result;
}


void afficheCase (caseMat *Case)
{
printf ("\n IdentCase= %d \n **********\n",Case->identCase);
printf ("H= %s \n",(Case->H)?"true":"false");
printf ("B= %s \n",(Case->B)?"true":"false");
printf ("D= %s \n",(Case->D)?"true":"false");
printf ("G= %s \n ",(Case->G)?"true":"false");

}

